package com.nuanshui.heatedloan.credit.mongodb;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.util.TypeUtils;
import com.mongodb.BasicDBObject;
import com.nuanshui.framework.utils.ReflectionUtils;
import com.nuanshui.heatedloan.baseservice.form.StatisticsForm;
import com.nuanshui.heatedloan.credit.facade.AllinPayRecordService;
import com.nuanshui.heatedloan.credit.model.record.AllinPayBillRecord;
import com.nuanshui.heatedloan.credit.pay.AllinPayResultNotify;
import com.nuanshui.heatedloan.middleware.mongodb.MongoUtil;
import com.nuanshui.heatedloan.pageable.Pager;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.CustomConversions;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;


@Repository
public class MongoServiceTest implements InitializingBean {

    @Autowired
    private AllinPayRecordService allinPayRecordService;

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public void afterPropertiesSet() throws Exception {

        //mongoConverter


//        {
//            Pager<AllinPayBillRecord> pager=new Pager<AllinPayBillRecord>(1,10);
//            Pager<AllinPayBillRecord> list=allinPayRecordService.findBillListByPage(pager,null);
//            list=null;
//        }
//        {
//            AllinPayBillRecord query=new AllinPayBillRecord();
//            query.setTrxCode("100014");
//            Pager<AllinPayBillRecord> pager=new Pager<AllinPayBillRecord>(1,10);
//            Pager<AllinPayBillRecord> list=allinPayRecordService.findBillListByPage(pager,query);
//            list=null;
//        }

//        AllinPayResultNotify item=new AllinPayResultNotify();
//        item.setAMOUNT("1");
//
//
//        StatisticsForm form= StatisticsForm.create(item);
//        BasicDBObject basicDBObject = BasicDBObject.parse(JSON.toJSONString(item));
//        MongoUtil.save(basicDBObject,AllinPayResultNotify.class);

//        AllinPayReqRecord re=new AllinPayReqRecord();
//        re.setOrderNo("1");
//        re.setTrxCode("114");
//
//        StatisticsForm form=StatisticsForm.create(re);
//
//        BasicDBObject basicDBObject = BasicDBObject.parse(JSON.toJSONString(re));
//        MongoUtil.save(basicDBObject,AllinPayReqRecord.class);
    }
}
